#ifndef CH395_CONFIG_H
#define CH395_CONFIG_H
#include "CH395CMD.h"
#include "CH395.h"

#define NET_MODULE_FLAG           "EdgeSmartStation"    //通信标识
#define NET_MODULE_DATA_LENGTH    60     
#define MODULE_CFG_LEN            20
#define SOCKET1_FLASH_ADDRESS     0x800C7000   //socket1 参数存放地址

typedef struct {
  uint8_t flag[16];                       
  uint8_t cmd;                            
  uint8_t id[6];                         
  uint8_t len;                            
  uint8_t dat[NET_MODULE_DATA_LENGTH];    
}UDP_DATA,*pUDP_DATA;

//----------------------------------------------------
//- UDP指令码 & 应答码
//----------------------------------------------------
#define NET_MODULE_CMD_SET      0X01     
#define NET_MODULE_CMD_GET      0X02     
#define NET_MODULE_CMD_RESET    0X03   
#define NET_MODULE_CMD_SEARCH   0X04    
#define NET_MODULE_CMD_RESTART  0x05

#define NET_MODULE_ACK_SET      0X81     
#define NET_MODULE_ACK_GET      0X82     
#define NET_MODULE_ACK_RESET    0X83     
#define NET_MODULE_ACK_SEARCH   0X84     


void CH395_ifconfig();
void CH395_load_socket_param();
void CH395_tcp_client_init();
void CH395_udp_init();
uint8_t  udp_prot_parse(uint8_t* buf);
#endif